<form action="index.php" method='post'>
<input type="hidden" name="<?php echo $url_module_param; ?>" value="rolepermission" />
<input type="hidden" name="issubmit" value="<?php echo getSessionRandomNumber("create"); ?>" />
<?php

$pdo=ClsLPDO::getNamedInstance();
$select="<select name='role_id' onchange='this.form.roleidsubmit.value=1;this.form.submit();'>";
if($arrRole)
foreach($arrRole as $id=>$role)
{
	$selected="";
	if($id==$role_id) $selected=" selected";
	$select=$select."<option value='$id' $selected>$role</option>";
}
$select=$select."</select>";
echo $select;
echo "<input type='hidden' name='roleidsubmit' value='0' />
<table width='50%'>";
echo "<tr>";
echo "<th>Feature</th>";
if($arrRowPermission)
foreach($arrRowPermission as $id=>$permission)
{
	echo "<th>";
	echo $permission;
	echo "</th>";
}
echo "</tr>";//trace($arrTable);
if($arrTable)
foreach($arrTable as $feature_id=>$arrRow)
{
	echo "<tr>";
	echo "<td>".$arrRowFeature[$feature_id]."</td>";
	foreach($arrRow as $permissiontype_id=>$arrData)
	{
		echo "<td style='text-align:center'><center>";
		if($arrData)
		{
			extract($arrData);
      		echo "<input type='checkbox' name='permission[$permission_id]' $selected />"; 
		}
		else 
		{
			echo 'X';	
		}
		echo "</center></td>";
	}
	echo "</tr>";
}
echo "</table>"; 
?>
<center><input type="submit" value="Submit" /></center>
</form>